package spynx.desl.runtime;

import spynx.desl.DeslPattern;
import spynx.util.ArgumentSet;

public interface IPatternMatchInfo extends IObjectVariable, IContextAware {
	
	public static final int SEEK_LOCAL_FROM_BEGIN = 0;
	public static final int SEEK_RELATIVE = 1;
	public static final int SEEK_FROM_END = 2;
	public static final int SEEK_GLOBAL_FROM_BEGIN = 3;
	
	CharSequence getInput();
	
	void setInput(CharSequence input);
	
	/**
	 * Get the current input position  
	 * @return
	 */
	int getPosition(); 
	
	/**
	 * Set the current input position
	 * @param value	new position
	 * @param mode seeking mode. 0 - absolute position from beginning,
	 *  1 - relative to current position, 2 - absolute position from ending.
	 * @return new position if succeed.
	 */
	int setPosition(int value, int mode);
	
	/**
	 * Get the matching status of this pattern
	 * @return true - pattern has been matched, false - otherwise.
	 */
	boolean isMatched();
	
	/**
	 * Update the matching status of this pattern
	 * @param value new matching status.
	 */
	void setMatched(boolean value);
	
	/**
	 * Return the begin position of the input in the parent input.
	 * @return
	 */
	int getBeginLocation();
	
	/**
	 * Set the begin position of the input in the parent input
	 * @param value
	 */
	void setBeginLocation(int value);
	
	/**
	 * Return the end position of the input in the parent input;
	 * @return
	 */
	int getEndLocation();
	
	/**
	 * Set the end position of the input in the parent input
	 * @param value
	 */
	void setEndLocation(int value);

	void updateEndLocation(int value);
	
	DeslPattern getPattern();
	
	void setPattern(DeslPattern pattern);
	
	CharSequence getLocalInput();
	
	int getGlobalPosition();
	
	int getMatchedLength();
	
	void intialize();

	void setReturnedResult(Object value);
	
	Object getReturnedResult();

	void setArguments(ArgumentSet options);
	
	ArgumentSet getArguments();
}
